package models;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;

public class ListComparator implements Comparator<Player>{

	@Override
	public int compare(Player arg0, Player arg1) {
		Iterator<Integer> iter0 = arg0.getValue().iterator();
		Iterator<Integer> iter1 = arg1.getValue().iterator();
		
		while(iter0.hasNext() && iter1.hasNext())
		{
			int comp = Integer.compare(iter0.next(), iter1.next());
			if(comp != 0)return comp;
		}
		
		if(iter0.hasNext())return 1;
		
		if(iter1.hasNext())return -1;
		
		return 0;
	}

}
